Optimal. Leaf size=74 \[ \frac {b \tanh ^{-1}\left (\frac {b+2 c x^n}{\sqrt {b^2-4 a c}}\right )}{a \sqrt {b^2-4 a c} n}+\frac {\log (x)}{a}-\frac {\log \left (a+b x^n+c x^{2 n}\right )}{2 a n} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.04, antiderivative size = 74, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 7, integrand size = 20, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.350, Rules used = {1371, 719, 29,
648, 632, 212, 642} \begin {gather*} \frac {b \tanh ^{-1}\left (\frac {b+2 c x^n}{\sqrt {b^2-4 a c}}\right )}{a n \sqrt {b^2-4 a c}}-\frac {\log \left (a+b x^n+c x^{2 n}\right )}{2 a n}+\frac {\log (x)}{a} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 29
Rule 212
Rule 632
Rule 642
Rule 648
Rule 719
Rule 1371
Rubi steps
\begin {align*} \int \frac {1}{x \left (a+b x^n+c x^{2 n}\right )} \, dx &=\frac {\text {Subst}\left (\int \frac {1}{x \left (a+b x+c x^2\right )} \, dx,x,x^n\right )}{n}\\ &=\frac {\text {Subst}\left (\int \frac {1}{x} \, dx,x,x^n\right )}{a n}+\frac {\text {Subst}\left (\int \frac {-b-c x}{a+b x+c x^2} \, dx,x,x^n\right )}{a n}\\ &=\frac {\log (x)}{a}-\frac {\text {Subst}\left (\int \frac {b+2 c x}{a+b x+c x^2} \, dx,x,x^n\right )}{2 a n}-\frac {b \text {Subst}\left (\int \frac {1}{a+b x+c x^2} \, dx,x,x^n\right )}{2 a n}\\ &=\frac {\log (x)}{a}-\frac {\log \left (a+b x^n+c x^{2 n}\right )}{2 a n}+\frac {b \text {Subst}\left (\int \frac {1}{b^2-4 a c-x^2} \, dx,x,b+2 c x^n\right )}{a n}\\ &=\frac {b \tanh ^{-1}\left (\frac {b+2 c x^n}{\sqrt {b^2-4 a c}}\right )}{a \sqrt {b^2-4 a c} n}+\frac {\log (x)}{a}-\frac {\log \left (a+b x^n+c x^{2 n}\right )}{2 a n}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.13, size = 72, normalized size = 0.97 \begin {gather*} -\frac {\frac {2 b \tan ^{-1}\left (\frac {b+2 c x^n}{\sqrt {-b^2+4 a c}}\right )}{\sqrt {-b^2+4 a c}}-2 \log \left (x^n\right )+\log \left (a+x^n \left (b+c x^n\right )\right )}{2 a n} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(396\) vs.
\(2(68)=136\).
time = 0.07, size = 397, normalized size = 5.36
method | result | size |
risch | \(\frac {4 n^{2} \ln \left (x \right ) a c}{4 a^{2} c \,n^{2}-a \,b^{2} n^{2}}-\frac {n^{2} \ln \left (x \right ) b^{2}}{4 a^{2} c \,n^{2}-a \,b^{2} n^{2}}-\frac {2 \ln \left (x^{n}-\frac {-b^{2}+\sqrt {-4 a \,b^{2} c +b^{4}}}{2 b c}\right ) c}{\left (4 a c -b^{2}\right ) n}+\frac {\ln \left (x^{n}-\frac {-b^{2}+\sqrt {-4 a \,b^{2} c +b^{4}}}{2 b c}\right ) b^{2}}{2 a \left (4 a c -b^{2}\right ) n}+\frac {\ln \left (x^{n}-\frac {-b^{2}+\sqrt {-4 a \,b^{2} c +b^{4}}}{2 b c}\right ) \sqrt {-4 a \,b^{2} c +b^{4}}}{2 a \left (4 a c -b^{2}\right ) n}-\frac {2 \ln \left (x^{n}+\frac {b^{2}+\sqrt {-4 a \,b^{2} c +b^{4}}}{2 b c}\right ) c}{\left (4 a c -b^{2}\right ) n}+\frac {\ln \left (x^{n}+\frac {b^{2}+\sqrt {-4 a \,b^{2} c +b^{4}}}{2 b c}\right ) b^{2}}{2 a \left (4 a c -b^{2}\right ) n}-\frac {\ln \left (x^{n}+\frac {b^{2}+\sqrt {-4 a \,b^{2} c +b^{4}}}{2 b c}\right ) \sqrt {-4 a \,b^{2} c +b^{4}}}{2 a \left (4 a c -b^{2}\right ) n}\) | \(397\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.38, size = 259, normalized size = 3.50 \begin {gather*} \left [\frac {2 \, {\left (b^{2} - 4 \, a c\right )} n \log \left (x\right ) + \sqrt {b^{2} - 4 \, a c} b \log \left (\frac {2 \, c^{2} x^{2 \, n} + b^{2} - 2 \, a c + 2 \, {\left (b c + \sqrt {b^{2} - 4 \, a c} c\right )} x^{n} + \sqrt {b^{2} - 4 \, a c} b}{c x^{2 \, n} + b x^{n} + a}\right ) - {\left (b^{2} - 4 \, a c\right )} \log \left (c x^{2 \, n} + b x^{n} + a\right )}{2 \, {\left (a b^{2} - 4 \, a^{2} c\right )} n}, \frac {2 \, {\left (b^{2} - 4 \, a c\right )} n \log \left (x\right ) + 2 \, \sqrt {-b^{2} + 4 \, a c} b \arctan \left (-\frac {2 \, \sqrt {-b^{2} + 4 \, a c} c x^{n} + \sqrt {-b^{2} + 4 \, a c} b}{b^{2} - 4 \, a c}\right ) - {\left (b^{2} - 4 \, a c\right )} \log \left (c x^{2 \, n} + b x^{n} + a\right )}{2 \, {\left (a b^{2} - 4 \, a^{2} c\right )} n}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 362 vs.
\(2 (63) = 126\).
time = 28.26, size = 362, normalized size = 4.89 \begin {gather*} \begin {cases} \frac {4 b c n \log {\left (x \right )}}{b^{3} n + 2 b^{2} c n x^{n}} - \frac {4 b c \log {\left (\frac {b}{2 c} + x^{n} \right )}}{b^{3} n + 2 b^{2} c n x^{n}} + \frac {4 b c}{b^{3} n + 2 b^{2} c n x^{n}} + \frac {8 c^{2} n x^{n} \log {\left (x \right )}}{b^{3} n + 2 b^{2} c n x^{n}} - \frac {8 c^{2} x^{n} \log {\left (\frac {b}{2 c} + x^{n} \right )}}{b^{3} n + 2 b^{2} c n x^{n}} & \text {for}\: a = \frac {b^{2}}{4 c} \\- \frac {x^{- n}}{b n} - \frac {c \log {\left (x^{n} \right )}}{b^{2} n} + \frac {c \log {\left (\frac {b}{c} + x^{n} \right )}}{b^{2} n} & \text {for}\: a = 0 \\\frac {\log {\left (x \right )}}{a + b + c} & \text {for}\: n = 0 \\\frac {\log {\left (x \right )}}{a} - \frac {\log {\left (\frac {a}{b} + x^{n} \right )}}{a n} & \text {for}\: c = 0 \\- \frac {b \log {\left (\frac {b}{2 c} + x^{n} - \frac {\sqrt {- 4 a c + b^{2}}}{2 c} \right )}}{2 a n \sqrt {- 4 a c + b^{2}}} + \frac {b \log {\left (\frac {b}{2 c} + x^{n} + \frac {\sqrt {- 4 a c + b^{2}}}{2 c} \right )}}{2 a n \sqrt {- 4 a c + b^{2}}} + \frac {\log {\left (x \right )}}{a} - \frac {\log {\left (\frac {b}{2 c} + x^{n} - \frac {\sqrt {- 4 a c + b^{2}}}{2 c} \right )}}{2 a n} - \frac {\log {\left (\frac {b}{2 c} + x^{n} + \frac {\sqrt {- 4 a c + b^{2}}}{2 c} \right )}}{2 a n} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.61, size = 224, normalized size = 3.03 \begin {gather*} \frac {\ln \left (-\frac {1}{c\,x}-\frac {\left (2\,a\,n+b\,n\,x^n\right )\,\left (4\,a\,c+b\,\sqrt {b^2-4\,a\,c}-b^2\right )}{2\,c\,x\,\left (a\,b^2\,n-4\,a^2\,c\,n\right )}\right )\,\left (4\,a\,c+b\,\sqrt {b^2-4\,a\,c}-b^2\right )}{2\,\left (a\,b^2\,n-4\,a^2\,c\,n\right )}-\frac {\ln \left (\frac {\left (2\,a\,n+b\,n\,x^n\right )\,\left (b\,\sqrt {b^2-4\,a\,c}-4\,a\,c+b^2\right )}{2\,c\,x\,\left (a\,b^2\,n-4\,a^2\,c\,n\right )}-\frac {1}{c\,x}\right )\,\left (b\,\sqrt {b^2-4\,a\,c}-4\,a\,c+b^2\right )}{2\,\left (a\,b^2\,n-4\,a^2\,c\,n\right )}+\frac {\ln \left (x\right )\,\left (n-1\right )}{a\,n} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________